package com.neuedu.corejava.ch7.homework3;

/**
 * 
 * 设计一个父类，保存学生属性
 * @author admin
 *
 */
public class Student implements IGradeAssessing,IShow{
	//学号
	private int studentId;
	//姓名
	private String name;
	//性别
	private String sex;
	//年龄
	private  int age;
	
	
	//期中考试成绩
	private double midtermGrade;
	//期末考试成绩
	private double finalExamGrade;
	
	
	public Student() {
		super();
	}

	public Student(int studentId, String name, String sex, int age, double midtermGrade, double finalExamGrade) {
		super();
		this.studentId = studentId;
		this.name = name;
		this.sex = sex;
		this.age = age;
		this.midtermGrade = midtermGrade;
		this.finalExamGrade = finalExamGrade;
	}

	public int getStudentId() {
		return studentId;
	}

	public void setStudentId(int studentId) {
		this.studentId = studentId;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getSex() {
		return sex;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}

	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		this.age = age;
	}

	public double getMidtermGrade() {
		return midtermGrade;
	}

	public void setMidtermGrade(double midtermGrade) {
		this.midtermGrade = midtermGrade;
	}

	public double getFinalExamGrade() {
		return finalExamGrade;
	}

	public void setFinalExamGrade(double finalExamGrade) {
		this.finalExamGrade = finalExamGrade;
	}
	
	
	
	@Override
	public double gradeAssessing() {
		//默认的成绩是：期中考试和期末考试的平均分
		return (midtermGrade+finalExamGrade)/2.0;
	}
	
	@Override
	public void showInfo() {
		System.out.print("学号："+getStudentId()+", ");
		System.out.print("姓名："+getName()+", ");
		System.out.print("性别："+getSex()+", ");
		System.out.print("年龄："+getAge()+", ");
		System.out.println("综合成绩："+gradeAssessing());
	}
	

}
